﻿@using System.Threading.Tasks
@using Abp.Extensions
@using Magicodes.Admin.Web.Public.Views.Shared.Components.Header
@model HeaderViewModel
<div class="pre-header">
    <div class="container">
        <div class="row">
            <div class="col-md-6 col-sm-6 additional-shop-info">
                <ul class="list-unstyled list-inline">
                    <li><i class="fa fa-phone"></i><span>+1 456 6717</span></li>
                    <li><i class="fa fa-envelope-o"></i><span>info@mydomain.com</span></li>
                </ul>
            </div>
            <div class="col-md-6 col-sm-6 additional-nav">
                <ul class="list-unstyled list-inline pull-right">
                    @if (Model.Languages.Count > 1)
                    {
                        <li>
                            <div id="LanguageDropDown" class="btn-group dropdown">
                                <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" data-delay="1000" data-close-others="true"><i class="@Model.CurrentLanguage.Icon"></i> @Model.CurrentLanguage.DisplayName <i class="fa fa-angle-down"></i></button>
                                <ul class="dropdown-menu" role="menu">
                                    @foreach (var language in Model.Languages)
                                    {
                                        if (Model.CurrentLanguage.Name == language.Name)
                                        {
                                            continue;
                                        }

                                        <li class="language-menu-item">
                                            <a href="@Url.Action("ChangeCulture", "AbpLocalization")?cultureName=@(language.Name)&returnUrl=@Context.Request.Path"><i class="@language.Icon"></i> <span>@language.DisplayName</span></a>
                                        </li>
                                    }
                                </ul>
                            </div>
                        </li>
                    }
                    @if (Model.LoginInformations?.User == null && Model.IsMultiTenancyEnabled && Model.TenantRegistrationEnabled && Model.IsInHostView)
                    {
                        <li>
                            <a href="@(string.Format("{0}{1}", Model.AdminWebSiteRootAddress,"?redirect=TenantRegistration&forceNewRegistration=true"))">@L("NewTenant")</a>
                        </li>
                    }
                    <li>
                        @if (Model.LoginInformations?.User != null)
                        {
                            <div id="LanguageDropDown" class="btn-group dropdown">
                                <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" data-delay="1000" data-close-others="true">@Model.GetShownLoginName() <i class="fa fa-angle-down"></i></button>
                                <ul class="dropdown-menu" role="menu">
                                    <li class="language-menu-item">
                                        <a href="@Url.Action("Logout", "Account")"><i class="icon-logout"></i> <span>@L("Logout")</span></a>
                                    </li>
                                </ul>
                            </div>
                        }
                        else
                        {
                            <a href="@(string.Format("{0}{1}?ss={2}&returnUrl={3}", Model.AdminWebSiteRootAddress, "account/login", "true", Model.WebSiteRootAddress + "Account/Login"))">@L("LogIn")</a> <!-- TODO: get url from setting or Request. -->
                        }
                    </li>
                </ul>
            </div>
        </div>
    </div>
</div>
<div class="header">
    <div class="container">
        <a class="site-logo" href="@Url.Action("Index", "Home")">
            <img src="@Model.GetLogoUrl(ApplicationPath)" alt="" width="168" height="33" />
        </a>
        <a href="javascript:void(0);" class="mobi-toggler"><i class="fa fa-bars"></i></a>
        <div class="header-navigation pull-right font-transform-inherit">
            <ul>
                @foreach (var menuItem in @Model.Menu.Items)
                {
                    @Html.Partial("Components/Header/_HeaderMenuItem", new HeaderMenuItemViewModel(menuItem, 0, Model.CurrentPageName))
                }
            </ul>
        </div>
    </div>
</div>